package com.cooge.jiexi;

public class sohu {

	public static void main(String[] args) throws Exception {
		
		String html = NetUtil.getHtml("http://tv.sohu.com/20150428/n411982554.shtml");
		
		int start = html.indexOf("var vid");
		
		int end = html.indexOf(";",start);
		String vid = html.substring(start, end).replaceAll("[^0-9]", "");
		
		String playvids = "http://hot.vrs.sohu.com/vrs_flash.action?vid="+vid;
		String vidhtml = NetUtil.getHtml(playvids);
		String superVid = (getVideoValue(vidhtml,"superVid"));
		String pid  =(getVideoValue(vidhtml,"pid"));
		String playurl    = "http://hot.vrs.sohu.com/ipad"+superVid+"_"+(System.currentTimeMillis()/1000)+"_"+pid+".m3u8?pg=1&pt=5&cv=5.0.0&qd=282&uid=a7c56462fe4506a7f268d2d095b1bf69&sver=5.0.0&plat=6&ca=3&prod=app";
		System.out.println(playurl);

	}
	public static String getVideoValue(String html, String key)throws Exception  {
		int start = html.indexOf(key);
		int end = html.indexOf(",", start);
		String value  = html.substring(start, end).replaceAll("[^0-9]", "");
		return value;
	}
	//http://hot.vrs.sohu.com/ipad2347056_1433124753_8993068.m3u8?plat=15&pt=6&prod=ott&pg=1&ch=v
}
